/**
 * @(#)ChargeLogFull.java.java	1.0  16-06-2014 
 *
 * Copyright 2014 Viettel Telecome. All rights reserved.
 * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */
package com.viettel.core.entities.report;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 *  GHI LOG CHARGING TREN SCHEMAS AGRI_REPORT
 *  @author: toantm1
 *  @since: 16-06-2014 - 08:34:53
 */
@Entity
@Table(name = "CHARGE_LOG_FULL")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@SequenceGenerator(name = "SEQ_STORE", sequenceName = "CHARGE_LOG_FULL_SEQ", allocationSize = 1)
public class ChargeLogFull implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3599218067057491987L;

	/** The id. */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STORE")
	@Column(name = "CHARGE_LOG_ID", precision=10, scale=0)
	private Long id;

	/**
	 * Thoi gian charge ket thuc
	 */
	@Basic
	@Column(name = "MSISDN", length = 14, nullable = false)
	private String msisdn;

	/**
	 * Thoi gian charge ket thuc
	 */
	@Basic
	@Column(name = "CHARGE_TIME", columnDefinition = "timestamp(6) default systimestamp", insertable = true, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date chargeTime;

	/**
	 * Ket qua charge: 0: OK, 1: Het tien, other: Fail
	 */
	@Basic
	@Column(name = "RESULT", precision = 1, scale = 0)
	private Byte result;

	/**
	 * SO TIEN CHARGE
	 */
	@Basic
	@Column(name = "FEE", precision = 10, scale = 0)
	private Long fee;
	
	/**
	 * Loai thue bao: PRE (11) | POS (22) | POS controller(33)
	 */
	@Basic
	@Column(name = "CUST_KIND", precision = 2, scale = 0)
	private Byte custKind;
	
	/**
	 * 1 - CDR Exported, 0: CDR Not Exported
	 */
	@Basic
	@Column(name = "EXPORTED", precision = 1, scale = 0)
	private Boolean exported;
	
	/**
	 * ID cua dich vu
	 */
	@Basic
	@Column(name = "SERVICE_ID", precision = 10, scale = 0)
	private Long serviceId;
	
	/**
	 * 0: Viettel, 1: Vina, Mobi
	 */
	@Basic
	@Column(name = "TELCO", precision = 1, scale = 0)
	private Byte telco;
	
	@Basic
	@Column(name = "SOURCE_ID", precision = 10, scale = 0)
	private Long sourceId;
	
	@Basic
	@Column(name = "SERVICE_NUMBER", length=20)
	private String serviceNumber;

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @return the msisdn
	 */
	public String getMsisdn() {
		return msisdn;
	}

	/**
	 * @return the chargeTime
	 */
	public Date getChargeTime() {
		return chargeTime;
	}

	/**
	 * @return the result
	 */
	public Byte getResult() {
		return result;
	}

	/**
	 * @return the free
	 */
	public Long getFee() {
		return fee;
	}

	/**
	 * @return the custKind
	 */
	public Byte getCustKind() {
		return custKind;
	}

	/**
	 * @return the exported
	 */
	public Boolean getExported() {
		return exported;
	}

	/**
	 * @return the serviceId
	 */
	public Long getServiceId() {
		return serviceId;
	}

	/**
	 * @return the telco
	 */
	public Byte getTelco() {
		return telco;
	}

	/**
	 * @return the sourceId
	 */
	public Long getSourceId() {
		return sourceId;
	}

	/**
	 * @return the serviceNumber
	 */
	public String getServiceNumber() {
		return serviceNumber;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param msisdn the msisdn to set
	 */
	public void setMsisdn(String msisdn) {
		this.msisdn = msisdn;
	}

	/**
	 * @param chargeTime the chargeTime to set
	 */
	public void setChargeTime(Date chargeTime) {
		this.chargeTime = chargeTime;
	}

	/**
	 * @param result the result to set
	 */
	public void setResult(Byte result) {
		this.result = result;
	}

	/**
	 * @param free the free to set
	 */
	public void setFee(Long fee) {
		this.fee = fee;
	}

	/**
	 * @param custKind the custKind to set
	 */
	public void setCustKind(Byte custKind) {
		this.custKind = custKind;
	}

	/**
	 * @param exported the exported to set
	 */
	public void setExported(Boolean exported) {
		this.exported = exported;
	}

	/**
	 * @param serviceId the serviceId to set
	 */
	public void setServiceId(Long serviceId) {
		this.serviceId = serviceId;
	}

	/**
	 * @param telco the telco to set
	 */
	public void setTelco(Byte telco) {
		this.telco = telco;
	}

	/**
	 * @param sourceId the sourceId to set
	 */
	public void setSourceId(Long sourceId) {
		this.sourceId = sourceId;
	}

	/**
	 * @param serviceNumber the serviceNumber to set
	 */
	public void setServiceNumber(String serviceNumber) {
		this.serviceNumber = serviceNumber;
	}
	
	public static List<ChargeLogFull> mapperData(List<ChargeLog> list){
    	List<ChargeLogFull> lst=new ArrayList<ChargeLogFull>();
    	for (ChargeLog chargeLog : list) {
    		ChargeLogFull charge=new ChargeLogFull();
    		charge.id = chargeLog.getId();
    		charge.msisdn = chargeLog.getMsisdn();
    		charge.chargeTime = chargeLog.getChargeTime();
    		charge.result = chargeLog.getResult();
    		charge.fee = chargeLog.getFee();
    		charge.custKind = chargeLog.getCustKind();
    		charge.exported = chargeLog.getExported();
    		charge.serviceId = chargeLog.getServiceId();
    		charge.telco = chargeLog.getTelco();
    		charge.sourceId = chargeLog.getSourceId();
    		charge.serviceNumber = chargeLog.getServiceNumber();
    		lst.add(charge);
		}
    	return lst;
    }

}
